package com.elite;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.SocketException;
import java.util.Date; 

import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;

import com.elite.algorithm.GUID;
public class test2 {
	public static void main(String args[]){
		FTPClient ftp;
		ftp = new FTPClient(); 
		try {
			ftp.connect("192.168.2.100",21);
		} catch (SocketException e) {
			// TODO Auto-generated catch block
			System.out.println(getERRO(e));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println(getERRO(e));
		}
		try {
			ftp.login("auto", "");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println(getERRO(e));
		}
		try {
			FTPFile[] ff1=ftp.listFiles();
			for(int i=0;i<ff1.length;i++){					
				String name=ff1[i].getName();
				System.out.println("name:"+name);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			System.out.println(getERRO(e));
		}
		
	}
	
	public static String getERRO(Exception e){
		String str="";
		try{
            StringWriter sw = new StringWriter();  
            e.printStackTrace(new PrintWriter(sw, true));  
            str = sw.toString(); 	
		}catch(Exception e1){
			str=e.toString();
//			log.error("getERRO:"+getERRO(e1));
		}
		return str;
	}
     
}
